<?php

$nsqdAddr = array(
    "106.13.63.203:4151",
);

$nsq = new Nsq();
$isTrue = $nsq->connectNsqd($nsqdAddr);

var_dump($isTrue);

//for($i = 0; $i < 10000; $i++){
    $nsq->publish("test", "nihao");
//}
$nsq->closeNsqdConnection();

// Deferred publish 
//function : deferredPublish(string topic,string message, int millisecond); 
//millisecond default : [0 < millisecond < 3600000]

$deferred = new Nsq();
$isTrue = $deferred->connectNsqd($nsqdAddr);
for($i = 0; $i < 20; $i++){
    $deferred->deferredPublish("test", "message daly", 3000); 
}
$deferred->closeNsqdConnection();









?>